<template>
  <div>
    <van-nav-bar
      title="账号登录"
      left-arrow
      @click-left="$router.push('./user')"
    />
    <van-form @submit="onSubmit">
      <van-field
        v-model="username"
        name="username"
        placeholder="请输入账号"
        :rules="[
          { required: true, message: '账号不能为空' },
          { pattern: /\w{5,}/, message: '账号至少包含5个字符' }
        ]"
      />
      <van-field
        v-model="password"
        type="password"
        name="password"
        placeholder="请输入密码"
        :rules="[
          { required: true, message: '密码不能为空' },
          { pattern: /\w{6,}/, message: '密码至少包含6个字符' }
        ]"
      />
      <div style="margin: 16px">
        <van-button block type="info" native-type="submit">登录</van-button>
      </div>
    </van-form>
    <div class="go-register">
      <router-link to="/register">没有账号，去注册~</router-link>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Login-page',
  components: {},
  props: {},
  data() {
    return {
      username: '',
      password: ''
    }
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    onSubmit(values) {
      console.log('submit', values)
    }
  }
}
</script>

<style scoped lang="less">
::v-deep .van-nav-bar__title {
  font-size: 18px;
}
.van-cell {
  line-height: 50px;
  font-size: 18px;
  &:nth-child(1) {
    margin-top: 15px;
  }
}
.van-button {
  height: 50px;
  font-size: 18px;
}
.go-register {
  width: 100%;
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: #666;
}
</style>
